fun mul(a: Int[][30], b:Int[][30], l: Int, m: Int, n: Int, result: Int[][30]) {
    for (var i=0; i<l; ++i)
        for (var j=0; j<n; ++j) {
            result[i][j] = 0;
            for (var k=0; k<m; ++k)
                result[i][j] = result[i][j]
                                + a[i][k] * b[k][j];
        }
}

fun input(a: Int[][30], m: Int&, n: Int&) {
    scanf("%d%d", m, n);
    for (var i=0; i<m; ++i)
        for (var j=0; j<n; ++j)
            scanf("%d", a[i][j]);
}

fun main(): Int {
    var m0: Int;
    var n0: Int;
    var a: Int[30][30];
    var m1: Int;
    var n1: Int;
    var b: Int[30][30];
    var c: Int[30][30];
    input(a, m0, n0);
    input(b, m1, n1);

    if (n0 == m1) {
        mul(a, b, m0, n0, n1, c);
        for (var i=0; i<m0; ++i) {
            for (var j=0; j<n1; ++j)
                printf("%10d", c[i][j]);
            printf("\n");
        }
    } else {
        printf("Incompatible Dimensions\n");
    }

    0
}